#pragma once

/*
*	Purpose:
*		The EditorEventHandler manages events.  Nouf said.
*
*/
#include "OpenGL.hpp"
#include "EditorManager.hpp"
#include "Timer.hpp"

class EditorManager;

class EditorEventHandler
{
public:
	EditorEventHandler();

	void SetEditorManager(EditorManager* editorManager) {m_pEditorManager = editorManager;}

	void HandleEvents(SDL_Event* event);
	void Update(); // Things called every frame, not just when events occur
	
	// Returns the mouse
	Vector2D GetScreenMouse() {return m_ScreenMouse;}
	Vector2D GetGameMouse() {return m_GameMouse;}
	Uint8*	 GetKeystates() {return m_Keystates;}

private:
	void HandleScrolling();
	void HandleGUI(SDL_Event* event);
	void HandleSelectionBox(SDL_Event* event);
	void HandleInput(SDL_Event* event);
	void HandleRoomSelection(SDL_Event* event);
	void HandleRoomMovement(SDL_Event* event);

	EditorManager* m_pEditorManager; // the editor

	bool m_FromPath, // this bool tells the image ID panel to tell the editor manager to create either a path or a room
		 m_MouseButtonDown, // this bool is true if the left mouse button is down
		 m_HandleMouseButtonUpRoomMovementEvent; // this bool tells us that we need to keep on generating new paths for a room that has been moved recently

	int m_MovementRoomID; // the ID of the room that we are currently moving

	Uint8 *m_Keystates; // the keystates
	Vector2D m_ScreenMouse, // mouse with screen coordinates
			 m_GameMouse;	// mouse with game coordinates

	SDL_Event* m_Event;

	Timer m_AlgorithmDelay; // the time after you click the algorithms that you can click the image IDS
};